package com.renyi.http;

import java.io.Serializable;

import com.alibaba.fastjson.JSON;

public class HttpResult implements Serializable {

	private static final long serialVersionUID = 1L;

	// 结果代码:0-成功，否则失�?
	private Integer code;

	// 错误信息
	private String msg = "";// 默认�?"

	// 数据结果�?
	private Object data;

	// 总条�?
	private Integer recordCount = 0;

	public Integer getRecordCount() {
		return recordCount;
	}

	public void setRecordCount(Integer recordCount) {
		this.recordCount = recordCount;
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		// this.data = data;
		// if(IsSerialize==1){
		try {
			String jsondata = JSON.toJSON(data).toString();
			this.data = jsondata;
		} catch (Exception e) {
			e.printStackTrace();
		}
		// }
	}

	/**
	 * 
	 * @param code
	 *            执行结果代码
	 * @param msg
	 *            执行结果描述
	 * @param data
	 *            执行结果数据
	 */
	public void setResult(Integer code, Object data, String msg) {
		this.code = code;
		this.msg = msg;
		// this.data = data
		// if(IsSerialize==0){
		try {
			String jsondata = JSON.toJSON(data).toString();
			this.data = jsondata;
		} catch (Exception e) {
			e.printStackTrace();
		}
		// }
	}

}
